package com.ruoyi.shop.delivery.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.shop.delivery.domain.ShopExpress;
import com.ruoyi.shop.delivery.mapper.ShopExpressMapper;
import com.ruoyi.shop.delivery.service.IShopExpressService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.text.Convert;

/**
 * 快递公司Service业务层处理
 * 
 * @author xuxiang
 * @date 2023-08-15
 */
@Service
public class ShopExpressServiceImpl implements IShopExpressService {
	@Autowired
	private ShopExpressMapper shopExpressMapper;

	/**
	 * 查询快递公司
	 * 
	 * @param expressId 快递公司主键
	 * @return 快递公司
	 */
	@Override
	public ShopExpress selectExpressById(Long expressId) {
		return shopExpressMapper.selectExpressById(expressId);
	}

	/**
	 * 查询快递公司列表
	 * 
	 * @param shopExpress 快递公司
	 * @return 快递公司
	 */
	@Override
	public List<ShopExpress> selectExpressList(ShopExpress shopExpress) {
		return shopExpressMapper.selectExpressList(shopExpress);
	}

	/**
	 * 新增快递公司
	 * 
	 * @param shopExpress 快递公司
	 * @return 结果
	 */
	@Override
	public int insertExpress(ShopExpress shopExpress) {
		shopExpress.setCreateTime(DateUtils.getNowDate());
		return shopExpressMapper.insertExpress(shopExpress);
	}

	/**
	 * 修改快递公司
	 * 
	 * @param shopExpress 快递公司
	 * @return 结果
	 */
	@Override
	public int updateExpress(ShopExpress shopExpress) {
		shopExpress.setUpdateTime(DateUtils.getNowDate());
		return shopExpressMapper.updateExpress(shopExpress);
	}

	/**
	 * 批量删除快递公司
	 * 
	 * @param expressIds 需要删除的快递公司主键
	 * @return 结果
	 */
	@Override
	public int deleteByExpressIds(String expressIds) {
		return shopExpressMapper.deleteByExpressIds(Convert.toStrArray(expressIds));
	}

	/**
	 * 删除快递公司信息
	 * 
	 * @param expressId 快递公司主键
	 * @return 结果
	 */
	@Override
	public int deleteByExpressId(Long expressId) {
		return shopExpressMapper.deleteByExpressId(expressId);
	}

	/**
	 * 查询可用快递列表
	 * 
	 * @return
	 */
	@Override
	public List<ShopExpress> queryExpresses() {
		return shopExpressMapper.queryExpresses();
	}
}
